import type { Biscuit } from "@/shared/bikkie/schema/attributes";
import type { BiomesId } from "@/shared/ids";

export const BikkieIds = {
  adminAxe: 4537020877769898 as BiomesId,
  adminRobot: 5424579032474707 as BiomesId,
  androgenous: 1534621126189718 as BiomesId,
  anyStone: 7539420629350051 as BiomesId,
  arcadeMachine: 4537020877769721 as BiomesId,
  arrowThroughHead: 4537020877770072 as BiomesId,
  aviatorHat: 8505535949917847 as BiomesId,
  axe: 4537020877770177 as BiomesId,
  azaleaSeed: 1534621126189370 as BiomesId,
  baitShrimp: 4537020877769676 as BiomesId,
  bananaSeed: 1534621126189361 as BiomesId,
  bboxMarker: 2874227533596773 as BiomesId,
  beanieWithSpinner: 4537020877770150 as BiomesId,
  bedrock: 1534621126189847 as BiomesId,
  bellBottoms: 7539420629349958 as BiomesId,
  bellFlowerSeed: 7539420629350027 as BiomesId,
  bigBowRibbon: 4537020877769649 as BiomesId,
  bigeye_tuna: 4537020877769685 as BiomesId,
  birchDoor: 7539420629350135 as BiomesId,
  birchSeed: 1534621126189373 as BiomesId,
  biomesRobot: 567816707675895 as BiomesId,
  bizzyCola: 1534621126189382 as BiomesId,
  bling: 1534621126189715 as BiomesId,
  blueprintAnglersTable: 8176147131639241 as BiomesId,
  blueprintBench: 6465116931230474 as BiomesId,
  blueprintCanopyFrame: 7868809447633355 as BiomesId,
  blueprintCommsTower: 3243584032760191 as BiomesId,
  blueprintComposter: 4590081419630270 as BiomesId,
  blueprintDyeOMatic: 3085780603082451 as BiomesId,
  blueprintFence: 663601322198230 as BiomesId,
  blueprintKitchen: 7642096223334102 as BiomesId,
  blueprintModernShelterFrame: 3504752154366770 as BiomesId,
  blueprintSeedMill: 5165478204705300 as BiomesId,
  blueprintSpaceAgeShelterFrame: 4313753143202106 as BiomesId,
  blueprintMarinaShoppingStall: 1825420459484848 as BiomesId,
  blueprintNetworkTower: 1056387151531327 as BiomesId,
  blueprintTTable: 6977805803201177 as BiomesId,
  blueprintTable: 7443636014830386 as BiomesId,
  blueprintTailoringBooth: 1534621126189445 as BiomesId,
  blueprintThermoblaster: 7539420629350102 as BiomesId,
  blueprintThermolite: 5013876656537945 as BiomesId,
  blueprintTraditionalShelterFrame: 1961861852831554 as BiomesId,
  blueprintWorkbench: 7539420629350159 as BiomesId,
  boombox: 4537020877769751 as BiomesId,
  boots: 1534621126189784 as BiomesId,
  bottoms: 4537020877770126 as BiomesId,
  bracelet: 4537020877769607 as BiomesId,
  branchesDoor: 4537020877769805 as BiomesId,
  bucket: 4537020877769799 as BiomesId,
  camera: 7539420629350492 as BiomesId,
  campfire: 7539420629350084 as BiomesId,
  carrotSeed: 4537020877769703 as BiomesId,
  catEars: 6033741616908993 as BiomesId,
  clay: 4537020877770021 as BiomesId,
  clearwaterFish: 5289515835017799 as BiomesId,
  clownfish: 1534621126189355 as BiomesId,
  cobblestone: 1534621126189850 as BiomesId,
  coffee: 7539420629350039 as BiomesId,
  coffeeSeed: 7539420629350021 as BiomesId,
  collectionClearwaterFish: 4568030285350437 as BiomesId,
  collectionHidden: 306648586067057 as BiomesId,
  collectionMuckwaterFish: 414147865674476 as BiomesId,
  collectionPlants: 2255417577913009 as BiomesId,
  dandelionSeed: 4537020877769697 as BiomesId,
  deathmatchEnter: 4537020877769580 as BiomesId,
  diamondGem: 1534621126189688 as BiomesId,
  diamondRough: 1534621126189661 as BiomesId,
  dirt: 4537020877770180 as BiomesId,
  divingGoggles: 1534621126189289 as BiomesId,
  dMucker: 6203259711678048 as BiomesId,
  ears: 7539420629350417 as BiomesId,
  emptyPowerCell: 456182840394405 as BiomesId,
  environmentGroup: 7539420629350486 as BiomesId,
  face: 4537020877770096 as BiomesId,
  feet: 4537020877770117 as BiomesId,
  fertilizer: 7722031585092164 as BiomesId,
  fencer: 4537020877770162 as BiomesId,
  fish: 7539420629350036 as BiomesId,
  fishWallMount: 4505322372247292 as BiomesId,
  flowerCrown: 7539420629349976 as BiomesId,
  fruit: 5973100997645477 as BiomesId,
  goldFrameExtraLarge: 4537020877769787 as BiomesId,
  goldFrameLarge: 7539420629350117 as BiomesId,
  goldNugget: 4537020877769991 as BiomesId,
  goldOre: 4537020877770012 as BiomesId,
  granite: 1534621126189835 as BiomesId,
  grapeSeed: 7539420629350018 as BiomesId,
  grass: 3588133005856146 as BiomesId,
  grassyBottom: 7539420629350447 as BiomesId,
  grassyTop: 7539420629350456 as BiomesId,
  hair: 4537020877770111 as BiomesId,
  hands: 1534621126189733 as BiomesId,
  hat: 7539420629350483 as BiomesId,
  hawaiiNecklace: 4537020877769613 as BiomesId,
  head: 4537020877770048 as BiomesId,
  homestone: 4537020877770105 as BiomesId,
  human: 7710316920007608 as BiomesId,
  isoCam: 1534621126189424 as BiomesId,
  zoomCam: 733889312712469 as BiomesId,
  kitchen: 1485695172010242 as BiomesId,
  koi: 7539420629350012 as BiomesId,
  lilacSeed: 7539420629350024 as BiomesId,
  log: 1534621126189436 as BiomesId,
  logger: 7539420629350156 as BiomesId,
  lumber: 7539420629350093 as BiomesId,
  mackerel: 4537020877769598 as BiomesId,
  mailbox: 3324897590409143 as BiomesId,
  megaAxe: 5882140068746936 as BiomesId,
  metagameLeaderboard: 7119759980118961 as BiomesId,
  metagameTeamLeaderboard: 7469132638841053 as BiomesId,
  minigameLeaderboard: 7539420629349913 as BiomesId,
  muckBuster: 6707679408294768 as BiomesId,
  muckBusterPlaceable: 2393237167156092 as BiomesId,
  smallLeaderboard: 8011452722498321 as BiomesId,
  muckerMeat: 7539420629350042 as BiomesId,
  muckerWard: 1534621126189403 as BiomesId,
  muckSickness: 6684250078122011 as BiomesId,
  muckwaterFish: 4832643896689956 as BiomesId,
  muckBusterRedux: 6857902760565950 as BiomesId,
  muckySkirt: 7539420629350447 as BiomesId,
  muckyTop: 7539420629350456 as BiomesId,
  neck: 1534621126189742 as BiomesId,
  neptuniumNugget: 7539420629350318 as BiomesId,
  npcGlobals: 8098279063715444 as BiomesId,
  oakDoor: 1534621126189475 as BiomesId,
  oakFrameExtraLarge: 4537020877769793 as BiomesId,
  oakFrameLarge: 7539420629350123 as BiomesId,
  oakFrameMedium: 1534621126189466 as BiomesId,
  oakFrameSmall: 4537020877769796 as BiomesId,
  oakLeaf: 4537020877770108 as BiomesId,
  oakLog: 4537020877770174 as BiomesId,
  oakSeed: 7539420629350030 as BiomesId,
  ogTShirt: 2324327372530115 as BiomesId,
  onionSeed: 7539420629350015 as BiomesId,
  outerwear: 1534621126189814 as BiomesId,
  parcel: 6974360313521877 as BiomesId,
  pickaxe: 4537020877770159 as BiomesId,
  pjBottoms: 1534621126189298 as BiomesId,
  pjTop: 1534621126189304 as BiomesId,
  playerGift: 5520363647038355 as BiomesId,
  playerGiftReward: 7745460915304320 as BiomesId,
  poncho: 1534621126189310 as BiomesId,
  potatoSeed: 4537020877769688 as BiomesId,
  powerCell: 3272526146499364 as BiomesId,
  pumpkin: 7539420629350498 as BiomesId,
  pumpkinSeed: 4537020877769718 as BiomesId,
  punkfish: 409324180050748 as BiomesId,
  rainbowTrout: 7539420629349925 as BiomesId,
  raspberrySeed: 7539420629350033 as BiomesId,
  recipePaper: 195703816729314 as BiomesId,
  recipeStick: 5091055626506796 as BiomesId,
  recordPlayer: 7839178235946121 as BiomesId,
  remoteControl: 4192471904673985 as BiomesId,
  ringWithGem: 1534621126189724 as BiomesId,
  roseSeed: 4537020877769694 as BiomesId,
  rubberDoor: 7539420629350132 as BiomesId,
  rubberLeaf: 7539420629350435 as BiomesId,
  rubberSeed: 4537020877769700 as BiomesId,
  sakuraSeed: 614675368016114 as BiomesId,
  salmon: 1534621126189352 as BiomesId,
  sashimi: 8659204791920139 as BiomesId,
  silverDoor: 4537020877769802 as BiomesId,
  silverFrameExtraLarge: 1534621126189460 as BiomesId,
  silverFrameLarge: 4537020877769790 as BiomesId,
  silverFrameMedium: 7539420629350120 as BiomesId,
  silverFrameSmall: 1534621126189463 as BiomesId,
  silverNugget: 7539420629350321 as BiomesId,
  simpleRaceCheckpoint: 1534621126189250 as BiomesId,
  simpleRaceFinish: 1534621126189256 as BiomesId,
  simpleRaceStart: 4537020877769586 as BiomesId,
  slabber: 7539420629350489 as BiomesId,
  slop: 6431351131865635 as BiomesId,
  smallOakSign: 1534621126189418 as BiomesId,
  smallShopContainer: 7539420629350114 as BiomesId,
  sombrero: 1534621126189313 as BiomesId,
  spikefish: 8157541487089990 as BiomesId,
  spleefSpawn: 370045597116844 as BiomesId,
  spleefStart: 6360374043406692 as BiomesId,
  stepper: 1534621126189832 as BiomesId,
  stone: 7539420629350510 as BiomesId,
  stonePick: 7539420629350249 as BiomesId,
  strawberrySeed: 4537020877769691 as BiomesId,
  sunBlockers: 1534621126189763 as BiomesId,
  superFertilizer: 791084442243108 as BiomesId,
  superStriker: 9004442862965136 as BiomesId,
  swimfin: 7539420629349949 as BiomesId,
  switchGrass: 7539420629350336 as BiomesId,
  tabler: 7539420629350324 as BiomesId,
  tailoringBooth: 7539420629350105 as BiomesId,
  tatteredSkirt: 1534621126189682 as BiomesId,
  tatteredTop: 7539420629350144 as BiomesId,
  thermoblaster: 4537020877769775 as BiomesId,
  tilledSoil: 1534621126189391 as BiomesId,
  tomatoSeed: 1534621126189358 as BiomesId,
  top: 7539420629350465 as BiomesId,
  treasureChest: 7539420629349916 as BiomesId,
  trout: 7539420629349922 as BiomesId,
  vegetable: 8533788965712880 as BiomesId,
  wand: 7539420629350501 as BiomesId,
  wardrobe: 1534621126189262 as BiomesId,
  wheatSeed: 1534621126189364 as BiomesId,
  woodContainer: 7539420629350138 as BiomesId,
  woodenFencer: 7539420629350252 as BiomesId,
  woodenSlabber: 4537020877769919 as BiomesId,
  woodenStepper: 4537020877769916 as BiomesId,
  workbench: 1534621126189448 as BiomesId,
  robotModule: 4432967087898065 as BiomesId,
};

type ItemTypeArray = [BiomesId, (b: Biscuit) => boolean][];
type ItemTypeMap = ReadonlyMap<BiomesId, (b: Biscuit) => boolean>;

export const WEARABLE_TYPES: ItemTypeArray = [
  [BikkieIds.hat, (b) => !!b.wearAsHat],
  [BikkieIds.outerwear, (b) => !!b.wearAsOuterwear],
  [BikkieIds.top, (b) => !!b.wearAsTop],
  [BikkieIds.bottoms, (b) => !!b.wearAsBottoms],
  [BikkieIds.feet, (b) => !!b.wearOnFeet],
  [BikkieIds.hair, (b) => !!b.wearAsHair],
  [BikkieIds.face, (b) => !!b.wearOnFace],
  [BikkieIds.ears, (b) => !!b.wearOnEars],
  [BikkieIds.neck, (b) => !!b.wearOnNeck],
  [BikkieIds.hands, (b) => !!b.wearOnHands],
];

export const WEARABLE_SLOTS = WEARABLE_TYPES.map(([id, _fn]) => id);
export type WearableSlot = (typeof WEARABLE_SLOTS)[number];

export const ITEM_TYPES: ItemTypeMap = new Map([
  [BikkieIds.anyStone, (b) => !!b.isAnyStone],
  [BikkieIds.log, (b) => !!b.isLog],
  [BikkieIds.lumber, (b) => !!b.isLumber],
  [BikkieIds.stepper, (b) => !!b.isTool && b.shape === "step"],
  [BikkieIds.slabber, (b) => !!b.isTool && b.shape === "slab"],
  [BikkieIds.fencer, (b) => !!b.isTool && b.shape === "fence"],
  [BikkieIds.axe, (b) => !!b.isAxe],
  [BikkieIds.pickaxe, (b) => !!b.isPickaxe],
  [BikkieIds.fish, (b) => !!b.isFish],
  [BikkieIds.fruit, (b) => !!b.isFruit],
  [BikkieIds.vegetable, (b) => !!b.isVegetable],
  [BikkieIds.muckwaterFish, (b) => !!b.isMuckwaterFish],
  [BikkieIds.clearwaterFish, (b) => !!b.isClearwaterFish],
  ...WEARABLE_TYPES,
]);
